package org.cuijq.thinking.in.spring.dependency.lookup;

import org.cuijq.thinking.in.spring.ioc.domain.User;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * @author by CuiJQ
 * @Classname NoUniqueBeanDefinitionExceptionDemo
 * @Description NoUniqueBeanDefinitionExceptionDemo Description
 * @Date 2021/6/28 20:13
 */
public class NoUniqueBeanDefinitionExceptionDemo {
  public static void main(String[] args) {
    AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
    ac.register(NoUniqueBeanDefinitionExceptionDemo.class);
    ac.refresh();
    try {
      ac.getBean(String.class);
    }catch (NoUniqueBeanDefinitionException e){
      e.printStackTrace();
    }

    ac.close();
  }

  @Bean
  public String bean1(){
    return "bean1";
  }
  @Bean
  public String bean2(){
    return "bean2";
  }

}
